#include <stdio.h>
struct Student{
    int id;
    int de;
    int cai;
    int sum;
    int rank;
}stu[100000];
bool cmp(Student a,Student b){
    if(a.rank != b.rank)
        return a.rank<b.rank;
    if(a.sum!=b.sum)   
        return a.sum>b.sum;
    if(a.de!=b.de)
        return a.de>b.de;
    return a.id<b.id;
}
int main(){
    int n,l,h;
    scanf("%d%d%d",&n,&l,&h);
    for (int i = 0; i < n; i++){
        scanf("%d%d%d",&stu[i].id,&stu[i].de,&stu[i].cai);
        stu[i].sum = stu[i].cai + stu[i].de;
        if(stu[i].de<l || stu[i].cai<l)
            stu[i].rank = 5;
        
    }

    return 0;
}